<?php 
if (! defined('BASEPATH')) {
	exit('Access Denied');
}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>系统用户管理---数据处理平台</title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>/static/css/admin/base.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>/static/css/admin/page.css">
<script src="<?php echo base_url();?>/static/js/jquery.js" language="javascript"></script>
<script src="<?php echo base_url();?>/static/js/admin/common.js" language="javascript"></script>
<script language="javascript">




function selAll()
{
	for(i=0;i<document.form2.id.length;i++)
	{
		if(!document.form2.id[i].checked)
		{
			document.form2.id[i].checked=true;
		}
	}
}
function noSelAll()
{
	for(i=0;i<document.form2.id.length;i++)
	{
		if(document.form2.id[i].checked)
		{
			document.form2.id[i].checked=false;
		}
	}
}


</script>
 
<script>
$(function(){
	ajax_data(1);
	$("#search").click(function(){	
		ajax_data(1);
	});
});
function common_request(page){
	
	var sys_name = $("#sys_name").val();
	var id  = $("#id").val();
	var action = 'ajax_data';
	var page = page ;
	var url="<?php echo site_url("admin/system/index/system_list");?>?inajax=1";
	var match = $("#match").val();
	var data_ = {
	
		'sys_name':sys_name,
		'action':action,
		'page':page,
		'id':id,
		'match':match
	};
	$.ajax({
		   type: "POST",
		   url: url ,
		   data: data_,
		   cache:false,
		   dataType:"json",
		 //  async:false,
		   success: function(msg){
		  // console.dir(msg);
			var code = msg.resultcode ;
			if(code <0){
				window.location.href="<?php echo site_url('admin/login/jump_permition_html');?>" ;
				return false ;
			}  
			
			result = msg.resultinfo.list.result ;
			
			var shtml = '';
			
			for(var i in result){
				
				shtml+='<tr height="22" bgcolor="#FFFFFF" align="center" onmouseout="javascript:this.bgColor=\'#FFFFFF\';" onmousemove="javascript:this.bgColor=\'#FCFDEE\';">';
				shtml+='<td>'+result[i].id+'</td>';
				shtml+='<td><input id="id" class="np" type="checkbox" value="'+result[i].id+'" name="id"></td>';
				shtml+='<td><a href="<?php echo site_url('admin/system/index/system_edit') ;?>?id='+result[i].id+'"><u>'+result[i].sys_user+'</u></a></td>';
				shtml+='<td>'+result[i].addperson+'</td>';
				shtml+='<td><font color="green">'+result[i].addtime+'</font></td>';
		
				
				shtml+='<td>'+result[i].status+'</td>';
				shtml+='<td><a href="<?php echo site_url('admin/system/index/system_edit') ;?>?id='+result[i].id+'" ><img src="<?php echo base_url();?>/static/image/admin/edit.png" title="编辑用户'+result[i].sys_user+'的信息"></a></td>';					
			}
			
			
			$("#result_p").html(shtml);
			//alert();
			$("#mynew_page").html(" ");
			$("#mynew_page").html(msg.resultinfo.list.page_string);
	
		   },
		   beforeSend:function(){
			   $("#result_p").html("<tr bgcolor=\"#FFFFFF\" align='center' height='50'><td colspan='9'><img src='<?php echo base_url() ;?>/static/image/admin/loadding.gif'></td></tr>"); 
			   $("#mynew_page").html('');

		   },
		   error:function(){
			   alert('服务器繁忙请稍候。。。。。。');
		   }
		  
		});		
	

}
function ajax_data(page){
	if(!page){
		page = 1 ;
	}else{
		common_request(page);
	}
}
//删除
function del(){
	var num = 0 ;
	var str = '' ;
	var ids = document.getElementsByName("id") ;
	for(var k = 0 ; k<ids.length ;k++){
		if(ids[k].checked){
			num++ ;
			str+=ids[k].value+"," ;
		}
	}
	if(num <= 0 ){
		alert('请选择删除');
		return false ;
	}
	str = str.substring(0,str.length-1);
	var before_o = {
		'colspan':7,
		'pic_url':'<?php echo base_url();?>/static/image/admin/loadding.gif'
	};
	ajax_delete(str,'<?php echo site_url('admin/system/index/system_del');?>','<?php echo site_url('admin/system/index/system_list');?>','<?php echo site_url('admin/login/jump_permition_html');?>',before_o);
}

</script>
 

</head>
<body leftmargin="0" topmargin="0">
<div class="nav_des">
	<div style="float: left">
	<span class="des">系统>></span>
	
	<a href="<?php echo site_url("admin/system/index/system_list");?>" class="nav_des_hover">系统用户管理</a>
	<a href="<?php echo site_url("admin/system/index/system_add");?>">系统用户添加</a>

	</div>
	<div id="ajax_wait" style="float:right"></div>
</div>

<!--  搜索表单  --> 	
<form name='form3' onsubmit="return false ">
<table width='100%'  border='0' cellpadding='1' cellspacing='1' bgcolor='#CBD8AC' align="center" style="margin-top:8px">
  <tr bgcolor='#EEF4EA'>
    <td background='<?php echo base_url();?>/static/image/admin/wbg.gif' align=''>
      <table border='0' cellpadding='0' cellspacing='0'>
        <tr>
          <td width='80'>
           	系统用户id：
        </td>
        <td width='150'>
          	<input type='text' name='id' value='' style='width:100px' id="id" />
        </td>
         
  
        <td width='100'>
           	系统用户名称：
        </td>
        <td width='300'>
          	<input type='text' name='sys_name' value='' style='width:150px' id="sys_name" />
          	<select id="match" style="width:100px">
          		<option value="1">模糊搜索</option>
          		<option value="2">精确搜索</option>
          	</select>
        </td>
         
        <td>
          <input name="imageField" type="image" src="<?php echo base_url();?>/static/image/admin/search.gif" width="45" height="20" border="0" class="np" id="search"/>
        </td>
       </tr>
      </table>
    </td>
  </tr>
</table>
</form>


<!--  内容列表   -->
<form name="form2">

<table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center" style="margin-top:8px">
<tr bgcolor="#E7E7E7">
	<td height="24" colspan="8" >&nbsp;系统管理 &nbsp;</td>
</tr>
<tr align="center" bgcolor="#FAFAF1" height="22">
	<td width="6%">ID</td>
	<td width="4%">选择</td>
	<td width="15%">系统用户名称</td>
	<td width="10%">添加者</td>
	<td width="10%">添加时间</td>

	<td width="8%">状态</td>

	<td width="10%">操作</td>
</tr>
<tbody id="result_p">

</tbody>
<tr bgcolor="#FAFAF1">
<td height="28" colspan="8">
	&nbsp;
	<a href="javascript:selAll()" class="coolbg">全选</a>
	<a href="javascript:noSelAll()" class="coolbg">取消</a>
	<a href="javascript:void(0)" class="coolbg" onclick="del()">删除</a>
</td>
</tr>
<tr align="right" bgcolor="#EEF4EA">

	<td height="36" colspan="9" align="right" id="mynew_page">
	<?php 
		if(isset($page_string)){
			echo $page_string ;
		}
	?>
	<!--翻页代码 --></td>
</tr>
</table>

</form>
<div id="p_result" style="width: 100%; background: none repeat scroll 0% 0% rgb(231, 231, 231); margin: 10px auto auto; text-align: center; height: 30px; line-height: 30px; display:none">
	<img src="<?php echo base_url() ;?>/static/image/admin/loadding.gif">
</div>
</body>
</html>